﻿Public Class ViewPhoto : Inherits View

	Public Overrides Sub Run()
		List.Clear()
		List.AddButton("Geri dön", AddressOf MainForm.GoBack)
		List.AddButton("Yeni albüm", AddressOf NewAlbum)
		For Each Album In Studio.Albums
			List.AddItem(Album.Name, Album.Name, My.Resources.photo)
		Next
	End Sub

	Public Overrides Sub Tapped(ByVal Key As String)
		MainForm.ShowAlbum(Key)
	End Sub

	Public Sub NewAlbum()
		Dim Name = InputBox("Yeni albüm adını girin", "Yeni albüm")
		If Name = "" Then Return
		Dim Album As New Album()
		Studio.Albums.Add(Name, Album)
		Album.Open(Name)
		Studio.Albums.Save()
		List.AddItem(Album.Name, Album.Name, My.Resources.photo)
	End Sub

End Class

Public Class ViewAlbum : Inherits View

	Public Overrides Sub Run()
		List.Clear()
		List.AddButton("Albümlere dön", AddressOf MainForm.GoBack)
		Dim Album = Studio.Albums(Key)
		Album.Open(Album.Name)
		For Each File In Album.Files
			List.AddItem(File.Name, File.Name, My.Resources.photo)
		Next
	End Sub

	Public Overrides Sub Tapped(ByVal Key As String)
	End Sub

	Public Overrides Sub Draw(ByVal e As ListBox.ListBoxDrawItemEventArgs)
		If e.Item.Key.ToLower.EndsWith(".jpg") Then
			Images.DrawThumb(e.Graphics, e.Rect, e.Item.Text, False)
		End If
	End Sub

End Class